﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="/plugins/slick.editors.js"></script>
    <script src="/plugins/slick.core.js"></script>
    <script src="/plugins/slick.checkboxselectcolumn.js"></script>
    <script src="/plugins/slick.autotooltips.js"></script>
    <script src="/plugins/slick.cellrangedecorator.js"></script>
    <script src="/plugins/slick.cellrangeselector.js"></script>
    <script src="/plugins/slick.cellcopymanager.js"></script>
    <script src="/plugins/slick.cellselectionmodel.js"></script>
    <script src="/plugins/slick.rowselectionmodel.js"></script>
    <script src="/plugins/slick.formatters.js"></script>
    <script src="/plugins/slick.grid.js"></script>
    <script src="/plugins/surge.core.js" type="text/javascript"></script>
    <script src="/plugins/surge.slickGrid.js" type="text/javascript"></script>
     <script src="/Scripts/AjaxLoading.js" type="text/javascript"></script>
    <script src="/Scripts/Helper.js" type="text/javascript"></script>
    <script type="text/javascript">
        var myLayout;
        var mysupLayout;
        $(document).ready(function () {

            //loadFrm("/page/userManagement.htm");

            myLayout = $('body').layout({
                west__size: 234
		, east__size: 300
                // RESIZE Accordion widget when panes resize
		, west__onresize: $.layout.callbacks.resizePaneAccordions
		, east__onresize: $.layout.callbacks.resizePaneAccordions
            });

//            mysupLayout = $('#mainFrame').layout({
//                center__paneSelector: ".inner-center"
//                , south__size: '90%'
//            });

            $('ul.dropdown').jdMenu();
            // ACCORDION - in the West pane
            $("#accordion1").accordion({ fillSpace: true });

            // ACCORDION - in the East pane - in a 'content-div'
            $("#accordion2").accordion({
                fillSpace: true
		, active: 1
            });


            // THEME SWITCHER
            addThemeSwitcher('.ui-layout-north', { top: '12px', right: '5px' });
            // if a new theme is applied, it could change the height of some content,
            // so call resizeAll to 'correct' any header/footer heights affected
            // NOTE: this is only necessary because we are changing CSS *AFTER LOADING* using themeSwitcher
            setTimeout(myLayout.resizeAll, 1000); /* allow time for browser to re-render with new theme */




        });
        function loadFrm(url) {

            $.get(url, function (content) {

                $('#mainFrame').html(content);

            });
        }
        function MsgBox(message) {
            $('#MessageBar').html(message);
        }
        var ndhelp = new Helper();
        var columnNDPriceGrid = [];
        var gridNDPrice;
        function getColumn(parameters) {

            columnNDPriceGrid.push({ id: 'mprodh_desc', name: '', field: 'mprodh_desc'
            });
            columnNDPriceGrid.push({ id: 'PrevNDPrice', name: 'Prev NDPrice', field: 'discountPrice'
            });
            columnNDPriceGrid.push({ id: 'NDPrice', name: 'NDPrice', field: 'NDPrice', editor: Slick.Editors.Integer
            });

        }
        var optionsNDprice = {
            editable: true,
            enableRowReordering: true,
            enableCellNavigation: true,
            asyncEditorLoading: false,
            autoEdit: false
        };
        function getLastNDPrice(parameters) {
            ndhelp.GetLastestNDPrice(function (data) {


            });
        }

        function refreshNDPriceGrid(parameters) {
            ndhelp.GetLastestNDPrice(function (ndPricedata) {
                gridNDPrice = new Slick.Grid("#NDPriceGrid", ndPricedata.RMember, columnNDPriceGrid, optionsNDprice);
                gridNDPrice.setSelectionModel(new Slick.RowSelectionModel({ selectActiveRow: true }));
                //gridNDPrice.registerPlugin(checkboxSelectorRole);
                gridNDPrice.onCellChange.subscribe(function (e, args) {
                    //updateRole(args.item);
                });
            });
        }
        $(function () {
            getColumn();
            refreshNDPriceGrid();

            //Init button
            $("#btnSave")
			.button({
                 
                icons: {
                    primary: "ui-icon-save"
                },
            })
			.click(function () {
			    var remark = $('#remark').val();
			    var remark2 = $('#remark2').val();
			    var datas = gridNDPrice.getData();
			    var data = { remark: remark, remark2: remark2, data: datas };
			    ndhelp.InserNDPrice(data, function(result) {
			        alert(result);
			    });
			    //alert(datas);
			});
           
           $("#btnEdit")
			.button({
                 
                icons: {
                    primary: "ui-icon-save"
                },
            })
			.click(function () {
			    
			});
           
        });
    </script>
</head>
<body>
    <div id="mainFrame" class="ui-layout-center" width="100%" height="600" frameborder="0"
        scrolling="auto">
        <div class="inner-center">
            <div style="height: 20px;">
            </div>
        </div>
        <div class="ui-layout-south">
            <div id="NDPriceGrid" style="width: 100%; height: 270px;">
            </div>
            <div>
                <div style="margin: 5px; vertical-align: middle;">
                    <div style="width: 60px; float: left;">
                        Remark:
                    </div>
                    <input id="remark" type="text" />
                </div>
                <div style="margin: 5px; vertical-align: middle;">
                    <div style="width: 60px; float: left;">
                        Remark2:
                    </div>
                    <input id="remark2" type="text" /></div>
            </div>
            <div>
                <button id="btnEdit">
                    Edit</button>
                <button id="btnSave">
                    Save</button>
            </div>
        </div>
    </div>
</body>
</html>
